package thread;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-12-10  19:45
 */
class MyTimerTask implements Comparable<MyTimerTask> {
    private long time;
    private Runnable runnable;
    public MyTimerTask(Runnable runnable, long delay) {
        this.runnable = runnable;
        this.time = System.currentTimeMillis() + delay;
    }

    public void run() {
        runnable.run();
    }

    @Override
    public int compareTo(MyTimerTask o) {
        return (int)(this.time - o.time);
    }
}

class Mytimer {
    private Thread thread = null;
    private PriorityQueue<MyTimerTask> queue = new PriorityQueue<>();
}
public class ThreadDemo27 {
    public static void main(String[] args) {

    }
}
